date_date_set
DateTime::setDate alias - Set the date of the DateTime object
date_date_set()
function sets a new date.
Return a new DateTime object, set a new date, and format the date:
<?php $date = date_create ( ) ; date_date_set ( $date , 2020 , 10 , 15 ) ; echo date_format ( $date , "Y/m/d" ) ; ?>
Try it yourself
date_date_set ( object , year , month , day ) ;
parameter | describe |
---|---|
object | Required. Specifies the DateTime object returned by date_create() . |
year | Required. The year in the specified date. |
month | Required. Months in the specified date. |
day | Required. The date in the specified date. |